package com.macken.zjh.render;

import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.macken.zjh.Stats;

public class BaseRender {
	SpriteBatch batch;

	public BaseRender(SpriteBatch batch) {
		this.batch = batch;
	}

	public void draw(TextureRegion region, int x, int y, int width, int height) {

		width = Stats.instance.convertWidth(width);
		height = Stats.instance.convertHeight(height);
		batch.draw(region, x, y, width, height);
	}

	public void draw(TextureRegion region, int x, int y) {
		x = Stats.instance.convertWidth(x);
		y = Stats.instance.convertHeight(y);
		draw(region, x, y, region.getRegionWidth(), region.getRegionHeight());
	}

	public void draw(TextureRegion region, int x, int y, int width) {
		x = Stats.instance.convertWidth(x);
		y = Stats.instance.convertHeight(y);
		float ratio = (float) width / region.getRegionWidth();
		int height = (int) (region.getRegionHeight() * ratio);
		draw(region, x, y, width, height);
	}
}
